<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
  <h2>{{firstName}} {{finalName}}</h2>
  <h2>{{firstName+" "+finalName}}</h2>
  <h2>{{getFullName()}}</h2>
  <h2>{{fullName}}</h2>

</div>
<script src="../js/vue.js"></script>
<script>
  const app = new Vue({
    el:'#app',
    data:{
      firstName:'login',
      finalName:'index'
    },
    //computed:计算属性()
    //计算属性会进行缓存，如果多次使用时，计算属性只会调用一次，methods函数会调用多次
    computed:{
      fullName:function () {
        return this.firstName+" "+this.finalName
      }
    },
    methods:{
      getFullName(){
        return this.firstName+" "+this.finalName
      }
    }
  })
</script>
</body>
</html>